import React,{useState} from 'react'
import {useNavigate} from 'react-router-dom'

export default function SportsNews() {
  const nav=useNavigate()
  const [list]=useState([
    {
      id:'s1001',
      title:'爱德华兹与李凯尔交换球衣号',
    },
    {
      id:'s1002',
      title:'湖人将给戴维斯提供续约报价'
    },
    {
      id:'s1003',
      title:'美国男篮公布世界杯众将号码'
    }
  ])

  const goDetail=(id)=>{
    nav(`/sportsDetail?id=${id}`)
  }
  return (
    <div>
       <h2>体育新闻</h2>
       <ul>
        {
          list.map((item,index)=><li key={index} onClick={()=>goDetail(item.id)}>
              {item.title}
          </li>)
        }
       </ul>
    </div>
  )
}
